0 REM" PONZO*83*WATERLOO 1 [143]" 10 POKE53281,15:POKE53280,12:PRINT"[144]" 11 PRINT"[147] C64 TUTOR-5 12 [153]"ORTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTAN^" 13 [153]"(null) THE ADC'S OF 6510 MACHINE LANGUAGE WAIT (null)":MS$[178]" WELCOME! " 14 [153]"/TANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANTANEXPSTOP" 30 [141]60000:[141]63100:[141]63000 31 [153]"LOADTHE MWAITICROPWAITROCESSOR UWAITNIT (MPU)" 32 [153]"IN THE C64 IS THE 6510WAIT." 33 [153]"HE (SHE?) WILL OBEY YOUR COMMANDS" 34 [153]"IF YOU CAN SPEAK THE RIGHT LANGUAGE" 35 [153]"...AND THAT'S MACHINE LANGUAGEWAIT." 36 [153]"WE'LL LEARN SOME MACHINE LANGUAGE" 37 [153]"IN THIS TUTORIAL." 38 [153]"BUT LET'S LET THE 6510WAIT TELL IT..." 39 [141]63000 40 [153]"LOADSPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(THE 6510WAITSPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(" 45 [153]"(null)WE'VE GOT A NUMBER OF INTERNAL" 50 [153]"'REGISTERS' WHICH HOLD 8-BIT BINARY" 60 [153]"NUMBERS(BYTES) FROM $00 TO $FF (IN HEX)." 65 [153]"(null)WE CALL THEM 'A' AND 'X' AND 'Y'." 66 [153]"(WE HAVE A FEW MORE..BUT WAIT..)" 70 [153]"(null)YOU MAY LOAD THEM WITH NUMBERS" 80 [153]"AND PERFORM ADDITION,SUBTRACTION," 90 [153]"TESTS FOR ZERO , > , < ETC.ETC." 100 [153]"(null)LET'S GO THROUGH SOME OF THESE 6510WAIT" 110 [153]"COMMANDS...":[141]63000 120 [153]"LOAD"A$X$Y$ 130 [153]SD$"HERE ARE A FEW OF THE COMMANDS" 140 [153]"IN MY REPERTOIRE:" 150 [141]63200 160 [153]"LDA #$F3" 170 [153]"LWAITOADWAIT THE AWAITCCUMULATOR WITH THE" 180 [153]"NUMBER F3 IN HEX..#$F3" 190 [153]"THIS IS AN IMMEDIATEWAIT LOAD." 200 MS$[178]" A=#$F3 ":[141]63300:N$[178]"11110011":[141]40110:[141]63200 210 [153]"LDX #$AB":MS$[178]" X=#$AB ":[141]63300 215 N$[178]"10101011":[141]40130:[141]63200 220 [153]"LDY #$DD":MS$[178]" Y=#$DD ":[141]63300:N$[178]"11011101":[141]40140 230 [141]63200:[153]"TAX":[153]"TWAITRANSFER CONTENTS OF AWAIT TO XWAIT." 235 MS$[178]" X=A ":[141]63300:[141]41130:[141]63200 240 [153]"TYA":[153]"TWAITRANSFER CONTENTS OF YWAIT TO AWAIT.":MS$[178]" A=Y " 245 [141]63300:[141]41410:[141]63200 250 [153]"..AND THERE'S TXAWAIT AND TAYWAIT." 270 [153]"HERE ARE SOME MOREWAIT:":[141]63200 280 [153]"INXWAIT":[153]"INWAITCREMENT THE XWAIT-REGISTER BY 1.":MS$[178]" X=X+1 " 290 [141]63300:N$[178]"10101100":[141]40130:[141]63200 300 [153]"DEXWAIT":[153]"DEWAITCREMENT THE XWAIT-REGISTER BY 1.":MS$[178]" X=X-1 " 310 [141]63300:N$[178]"10101011":[141]40130:[141]63200 320 [153]"AND THERE'S INYWAIT AND DEYWAIT.":[141]63200 330 [153]M$:N$[178]"10110101":PP[178]0:[141]40160:[153]ML$"$1234":PP[178]20 340 [153]SD$"INC $1234WAIT":[153]"INCWAITREMENTS MEMORY LOCATION $1234" 350 MS$[178]" M=M+1 ":[141]63300:N$[178]"10110110":[141]40160:[141]63200 360 [153]"DEC $1234WAIT":[153]"DECWAITREMENTS MEMORY LOCATION $1234" 370 MS$[178]" M=M-1 ":[141]63300:N$[178]"10110101":[141]40160:[141]63200 380 [153]"ASLWAIT":[153]"AWAITRITHMETIC SWAITHIFT LWAITEFT" 390 [153]"ALL BITS OF THE AWAIT-REGISTER MOVE" 400 [153]"MOVE LEFT. A '0' COMES INTO THE 'LSB'" 410 [153]"AND THE 'MSB' DROPS INTO THE 'CARRY'." 420 [153]"(null)LSB=LEAST SIGNIFICANT BIT" 430 [153]"(null)MSB=MOST SIGNIFICANT BIT" 435 MS$[178]" A=2*A ":[141]63300 440 [153]C$:[151]C,49:N$[178]"10111010":PP[178]500:[141]40098:[141]63200:PP[178]20 450 [153]CC$:[151]C,32 460 [153]SD$"SECWAIT":[153]"SEWAITT THE CWAITARRY BIT." 470 [153]CR$:MS$[178]" CARRY=1 ":[141]63300:[151]C,49:[141]63200 480 [153]SD$"CLCWAIT":[153]"CLWAITEAR CWAITARRY BIT.":MS$[178]" CARRY=0 " 490 [141]63300:[153]CR$:[151]C,48:[141]63200:[153]CC$ 500 [153]"STA $1234WAIT":[153]"STWAITORE THE AWAIT-REGISTER" 510 [153]"IN MEMORY LOCATION $1234":MS$[178]" M=A ":[141]63300 520 N$[178]"10111010":[141]41160:[141]63000 600 [153]"LOADTHAT'S ENOUGH. LET'S CLEAR THE SCREEN." 610 [153]"LDA #$20 _LOAD A WITH #$20='SPACE'." 620 [153]"STA $0400 RIGHT$":[153]"STA $0401 (null)_FILLS SCREEN" 630 [153]"STA $0402 (null)_MEMORY WITH #$20." 640 [153]"--- ----- .----------------":[153]"STA $07FF (null)_HENCE CLEAR SCREEN" 650 [153]"BUT WE CLEARLY NEED SOMETHING LIKE:":[153]"LDA #$20" 660 [153]"FOR X=0 TO #$3FF":[153]"STA $0400+X":[153]"NEXT X":[141]63000 670 [153]"LOADORCMDCMDFREFRE":[153]"BEGIN LDA #$20 _NOTE STATEMENT LABEL" 680 [153]" LDX #$00":[153]"LOOP STA $0400,X _INDEXED ADDRESSING" 690 [153]" ^ INX":[153]" (null) ?CHECK FOR X=#$3FF?" 695 [153]" /TAN IF NOT,GOTO 'LOOP'" 700 [153]"WE HAVE COMPAREWAIT & BRANCHWAIT INSTRUCTIONS!" 710 [153]"WHAT WE NEED ABOVE IS:":[153]"CWAITOMPWAITARE XWAIT TO #$3FF" 720 [153]"& BWAITRANCH IF NWAITOT EWAITQUAL..TO 'LOOP'":[141]63010 730 [153]"BEGIN LDA #$20 WAIT " 740 [153]" LDX #$00 ":[153]"LOOP STA $0400,X" 750 [153]" ^ INX ":[153]" (null) CPX #$3FF WAIT " 760 [153]" /TAN BNE LOOP WAIT ":[141]63200 770 [153]"NOTECMDCMDCMDCMDFREFREFREFREON:WE WILL NEVER STAWAIT IN $07FFWAIT" 780 [153]"IN THE ABOVE PROGRAM...SO...":[141]63010 790 [153]" (null) CPX #$400 ":[141]63200 800 [153]"ALSO, WE CAN CPX #$NWAIT ONLY IF N LIES" 810 [153]"IN THE RANGE $00 TO $FF." 820 [153]"SO WE CHANGE THE CODE TO:":[141]63010 830 [153]"LOADBEGIN LDA #$20 WAIT" 840 [153]" LDX #$00 ":[153]"LOOP STA $0400,X" 850 [153]" STA $0500,X" 860 [153]" STA $0600,X" 870 [153]" STA $0700,X" 880 [153]" INX ":[153]" CPX #$FF WAIT" 890 [153]" BNE LOOP WAIT":[141]63000 900 [153]SD$"";:[129]T[178]1[164]10:[153]CL$:[130]:[153]SD$""; 910 [153]"OR, WE CAN SIMPLIFY THIS A LITTLE BY" 920 [153]"COUNTING DOWNWAIT FROM X=$FF TO $00":[141]63010 930 [153]"BEGIN LDA #$20 WAIT" 940 [153]" LDX #$FF ":[153]"LOOP STA $0400,X" 950 [153]" STA $0500,X" 960 [153]" STA $0600,X" 970 [153]" STA $0700,X" 980 [153]" DEX " 990 [153]" BNE LOOP WAIT":[153]" ":[141]63000 991 [153]SD$"";:[129]T[178]1[164]10:[153]CL$:[130]:[153]SD$""; 995 [153]"HOW CAN WE BNEWAIT WHEN WE DON'T DO ANY" 996 [153]"COMPAREWAIT?":[141]63000 1000 [153]"LOADYOU SEE, BNEWAIT REALLY CHECKS TO SEE" 1010 [153]"IF '0' IS THE RESULT OF AN ARITHMETIC" 1020 [153]"OPERATION..INCLUDING A COMPAREWAIT." 1030 [153]"IN THE PAIR OF INSTRUCTIONS:" 1040 [153]"CPX #$FF":[153]"BNE LOOP":[153]"WE SUBTRACT #$FF FROM THE" 1050 [153]"VALUE OF X AND BRANCHWAIT TO LOOP IF" 1060 [153]"THE RESULT IS NOT ZERO!":[141]63000 1070 [153]"LOADINX ":[153]"BNE LOOP" 1080 [153]"WE BRANCH TO LOOP IF THE RESULT OF" 1090 [153]"INCREMENTING X IS NOTWAIT ZERO.":[153]"FREFREFRE" 1100 [153]"DEC $1234":[153]"BNE LOOP " 1110 [153]"HERE WE BRANCH TO LOOP IF" 1120 [153]"DECREMENTING $1234 IS NOT ZERO.":[153]"FREFREFRE" 1130 [153]"NOTEWAIT: CPXWAIT INVOLVES A SUBTRACTION" 1140 [153]"(TO CHECK FOR ZERO RESULT)" 1150 [153]"BUT IT DOES NOTCMDCMDCMDFREFREFREON CHANGE ANY REGISTERS!":[141]63000 1160 [153]"LOADLET'S RVSWAIT THE SCREEN." 1170 [153]"THIS REQUIRES LOOKING AT EVERY SCREEN" 1180 [153]"MEMORY LOCATION AND CHECKING THE MSBWAIT." 1190 [153]"IF IT'S 1WAIT THEN CHANGE IT TO 0WAIT." 1200 [153]"IF IT'S 0WAIT THEN CHANGE IT TO 1WAIT." 1300 [153]"(THE MSB DETERMINES IF THE CHARACTER" 1310 [153]"IS IN RVS-FIELD)!" 1320 [153]"WE'LL:":[153]"LDA $0400,X":[153]"EOR #$80 WAIT __???":[153]"STA $0400,X" 1330 [153]"EORWAIT IS AN EWAITXCLUSIVE ORWAIT!":[141]63000 1340 [153]"LOADIF AWAIT CONTAINS 10110101WAIT (AFTER LDAWAIT)" 1350 [153]"THEN EOR #$80WAIT DOES AN EXCLUSIVE-OR" 1360 [153]"WITH 10000000WAIT ($80 IN HEX)" 1370 [153]"AND GIVES 00110101WAIT..VERY NICE!" 1380 [153]"OUR PROGRAM MIGHT GO:" 1390 [153]"BEGIN LDX #$FF ":[153]"LOOP LDA $0400,X" 1400 [153]" EOR #$80 ":[153]" STA $0400,X" 1410 [153]" LDA $0500,X":[153]" EOR #$80 " 1420 [153]" STA $0500,X":[153]"ETC. ETC..UNTIL..WAIT" 1430 [153]" STA $0700,X" 1440 [153]" DEX ":[153]" BNE LOOP ":[141]63000 1450 [153]"LOADIT'S CLEAR THAT THIS WILL NOT DO IF" 1460 [153]"WE WANT TO GO FROM $0400 TO $0500 TO" 1470 [153]"..TO $0N00,INSTEAD OF JUST TO $0700." 1480 [153]"WE NEED A LOOP-WITHIN-A-LOOP" 1490 [153]"FOR LARGE N...SOMETHING LIKE:" 1500 [153]" M=$0400":[153]" X=N _N INSTEAD OF 3" 1510 [153]"LP1 Y=#$FF":[153]"LP2 LDA M+Y":[153]" EOR #$80" 1511 [153]" STA M+Y":[153]" Y=Y-1" 1512 [153]" IF Y<>0 GOTO LP2 ":[153]" M=M+$100":[153]" X=X-1" 1513 [153]" IFX<>0 GOTO LP1 ":[141]63000 1514 [153]""[163]23)"_WON'T DO Y=0WAIT!" 1515 [153]""[163]23)"_WON'T DO X=0WAIT!!":[141]63000 1516 [153]"";:[129]I[178]1[164]10:[153]CL$:[130]:[153]"WE'LL CHANGEWAIT IT TO:" 1517 [141]63010:[153]" M=$0400":[153]" X=N" " 1518 PRINT"LP1 Y=#$00 ":PRINT"LP2 LDA M+Y":PRINT" EOR #$80" 1519 PRINT" STA M+Y":PRINT" Y=Y-1" 1520 PRINT" IF Y<>0 GOTO LP2 ":PRINT" M=M+$100":PRINT" X=X-1" 1521 PRINT" IFX>=0 GOTO LP1 [146]":GOSUB63000:PRINT""; 1522 PRINT"WE WORK ON M+00 FIRST,THEN Y=Y-1[146]" 1523 PRINT"WILL CHANGE Y=00 TO Y=FF(!) AND WE'LL" 1524 PRINT"CONTINUE WITH M+FF THEN M+FE..TO M+01" 1525 PRINT"AND WE STOP THE Y-LOOP THERE!" 1526 PRINT"THE X-LOOP STARTS WITH X=N AND EACH" 1527 PRINT"X=X-1[146] CHANGES X TO N-1,N-2,..2,1,0 THEN[146]" 1528 PRINT"ONE MORE X=X-1[146] CHANGES X TO FF(!) WHICH" 1529 PRINT"IS NEGATIVE[146](!) AND WE STOP THE X-LOOP!" 1530 PRINT"NOTE[146]:THE 6510 REGISTERS CAN HOLD #'S" 1531 PRINT"FROM $00 TO $FF.IF WE HAVE 00[146] AND" 1532 PRINT"DECREMENT[146],IT CHANGES TO FF[146]..AND FF+1[146]=00[146]" 1533 PRINT"FINALLY,MSB=1[146] SIGNIFIES A NEGATIVE NO.[146]!";:GOSUB63000 1540 PRINT"[147]LET'S TRY SOMETHING LIKE:" 1550 PRINT"BEGIN LDA #$0400 [146]_??*!#$0400 TOO BIG!!" 1555 PRINT" STA $B0 [146]_$B0 NOW HAS #$0400" 1560 PRINT" LDX #$03 ":PRINT"LP1 LDY #$00 " 1570 PRINT"LP2 LDA ($B0),Y[146]_ INDIRECT INDEXED?":PRINT" EOR #$80 " 1580 PRINT" STA ($B0),Y[146]_ INDIRECT INDEXED!":PRINT" DEY " 1590 PRINT" BNE LP2 ":PRINT" INC $B0 BY #$100[146]_??*!!HOW??" 1600 PRINT" DEX ":PRINT" BPL LP1 [146]_BRANCH ON PLUS!!" 1610 PRINT"LDA ($B0),Y[146] TAKES THE CONTENTS OF" 1620 PRINT"MEMORY LOC'N $B0, ADDS Y, AND THIS[157][157][157][157][184][184][184][184]" 1625 PRINT"GIVES THE ADDRESS OF THE BYTE WHICH " 1626 PRINT"GETS LOADED INTO 'A'!!":GOSUB63000 1630 PRINT"[147]THERE ARE SOME NEW IDEAS..AND PROBLEMS!" 1635 PRINT"BUT FIRST LET'S AGREE THAT WE'LL" 1636 PRINT"USE $B0 TO REFER TO THE MEMORY LOC'N" 1637 PRINT"AND ($B0) TO REFER TO THE CONTENTS" 1638 PRINT"OF MEMORY LOCATION $B0." 1640 PRINT"LET'S LOOK AT ADDRESSING MODES[146]:":GOSUB63000 1650 PRINT"[147]BASIC"TAB(20)"ASSEMBLER" 1655 PRINT"[184][184][184][184][184]"TAB(20)"[184][184][184][184][184][184][184][184][184]" 1660 PRINT"A=5[146]"TAB(20)"LDA #$05[146]" 1670 PRINT"[209]IMMEDIATE MODE. THE ACCUMULATOR" 1680 PRINT"IS LOADED WITH THE # 5." 1690 PRINT"A=M(5)[146]"TAB(20)"LDA $05[146]" 1700 PRINT"[209]ABSOLUTE ADDRESSING. 'A' IS" 1710 PRINT"LOADED WITH THE CONTENTS OF" 1720 PRINT"MEMORY LOCATION 5." 1730 PRINT"A=M(5+X)[146]"TAB(20)"LDA $0005,X" 1740 PRINT"[209]ABSOLUTE INDEXED[146]. THE CONTENTS" 1750 PRINT"OF LOC'N (5+X) ARE LOADED INTO 'A'." 1760 PRINT"A=M(M(5+X))[146]"TAB(20)"LDA ($0005,X)" 1770 PRINT"[209]INDEXED INDIRECT[146]. THE CONTENTS" 1780 PRINT"OF LOC'N (5+X) GIVE THE ADDRESS OF" 1790 PRINT"THE BYTE TO BE LOADED INTO 'A'.":GOSUB63000 1800 PRINT"[147]THEN THERE'S OUR FRIEND:" 1810 PRINT"A=M(M(5)+Y)[146]"TAB(20)"LDA ($05),Y[146]" 1820 PRINT"[209]INDIRECT INDEXED[146]. FIRST, THE CONTENTS" 1830 PRINT"OF LOC'N 5 ARE EXTRACTED.THEN 'Y'" 1840 PRINT"IS ADDED AND THE RESULT GIVES THE" 1850 PRINT"ADDRESS OF THE BYTE LOADED INTO 'A'.":GOSUB63000 1860 PRINT"[147][209]INDIRECT[146] MEANS WE GO TO A MEMORY LOC'N" 1870 PRINT"TO GET THE ADDRESS OF THE BYTE TO BE" 1880 PRINT"LOADED INTO THE ACCUMULATOR." 1890 PRINT"[209]INDEXED[146] MEANS WE ADD THE CONTENTS" 1900 PRINT"OF A 6510[146] REGISTER TO AN ADDRESS." 1910 PRINT"[209]IF WE INDEX[146] THEN INDIRECT[146] IT'S" 1920 PRINT"INDEXED INDIRECT[146]..AS IN LDA ($0400,X)" 1930 PRINT"[209]IF WE INDIRECT[146] THEN INDEX[146] IT'S" 1940 PRINT"INDIRECT INDEXED[146]..AS IN LDA ($B0),Y":GOSUB63000 1950 MS$="CLEAR?!*$&":GOSUB63100:GOSUB63000 1960 PRINT"[147]LET'S EXPLAIN ABOUT MEMORY[146]." 1970 PRINT"6510[146] INSTRUCTIONS ARE STORED IN MEMORY" 1980 PRINT"AS 1- OR 2- OR 3- HEX BYTES." 1990 PRINT"INX[146]=E8[146] IS ONE BYTE LONG 2000 [153]"LDA #$05WAIT=AD 05WAIT IS TWO BYTES" 2010 [153]"LDA $1234,XWAIT=BD 34 12WAIT IS THREE BYTES." 2020 [153]" ^^ ^^" 2030 [153]"IN GENERAL, 2-BYTE ADDRESSES ARE" 2040 [153]"STORED IN MEMORY IN REVERSE ORDER:" 2050 [153]"LO-BYTEWAIT THEN HI-BYTEWAIT." 2060 [153]"SO IF YOU HAVE:" 2070 [153]"LDA ($B0),YWAIT=B1 CAWAIT THE 6510 WILL" 2080 [153]"GET FROM $B0 THE LO-BYTEWAIT OF THE" 2090 [153]"ADDRESS,AND FROM $B1 THE HI-BYTEWAIT!" 2100 [153]"(null)BE SURE TO PUT BOTH BYTES IN $B0/$B1" 2110 [153]"BEFORE LDA ($B0),YWAIT!!":[141]63000 2120 [153]"LOADLET'S GET BACK TO:" 2130 [153]"BEGIN LDA #$0400 WAIT_??*!#$0400 TOO BIG!!" 2140 [153]" STA $B0 WAIT_$B0 NOW HAS #$0400" 2150 [153]" LDX #$03 ":[153]"LP1 LDY #$00 " 2160 [153]"LP2 LDA ($B0),YWAIT_ INDIRECT INDEXED?":[153]" EOR #$80 " 2170 [153]" STA ($B0),YWAIT_ INDIRECT INDEXED!":[153]" DEY " 2180 [153]" BNE LP2 ":[153]" INC $B0 BY #$100WAIT_??*!!HOW??" 2190 [153]" DEX ":[153]" BPL LP1 WAIT_BRANCH ON PLUS!!" 2200 [153]"WE NOW MUST PUT $0400 INTO $B0/$B1" 2210 [153]"WITH LDA #$00WAIT STA $B0WAIT LDA #$04WAIT STA $B1WAIT." 2220 [153]"ALSO INC $B0 BY #$100WAIT IS CHANGED TO:" 2230 [153]"INC $B1WAIT... WE NEED ONLY INCWAIT THE" 2240 [153]"HI-BYTE BY '1'!":[141]63000 2250 [153]"LOADWE'LL CHANGE OUR PROGRAM TO:" 2260 [153]"BEGIN LDA #$00 WAIT":[153]" STA $B0 " 2270 [153]" LDA #$04 ":[153]" STA $B1 " 2280 [153]" LDX #$03 ":[153]"LP1 LDY #$00 " 2290 [153]"LP2 LDA ($B0),YWAIT":[153]" EOR #$80 " 2300 [153]" STA ($B0),YWAIT":[153]" DEY " 2310 [153]" BNE LP2 ":[153]" INC $B1 " 2320 [153]" DEX ":[153]" BPL LP1 WAIT":[141]63000 2330 [153]"WE NEEDN'T LDY #$00WAIT EACH" 2340 [153]"TIME WE BPL LP1":[153]"Y=0 ALREADY SO:":[141]63010 2350 [153]" ":[153]"LOOP":[153]"LOOP" 2355 [153]"LOOP":[141]63000 2360 [153]"":[129]I[178]1[164]6:[153]CL$:[130] 2370 [153]"NOTE THAT LDX #$03WAIT CAN" 2380 [153]"BE CHANGED TO ANYTHING FROM" 2390 [153]"LDX #$01WAIT TO LDX #$80WAIT.":[141]63000 2400 [153]"":[129]I[178]1[164]6:[153]CL$:[130] 2410 [153]"FOR LDX #$00WAIT WE'LL X-LOOP ONCE ANYWAY!" 2420 [153]"FOR LDX #$81WAIT,OR HIGHER,DEXWAIT" 2430 [153]"WILL LEAVE 'MSB'=1 IN THE X-REGISTER" 2440 [153]"AND X<0 WILL RESULT AND BPLWAIT WILL" 2450 [153]"NOTWAIT TAKE US BACK TO 'LOOP'!":[141]63000 2460 [153]"":[129]I[178]1[164]6:[153]CL$:[130] 2470 [153]"NOTE THAT ($B1) WILL NOT" 2480 [153]"OVERFLOWWAIT AFTER A NUMBER OF INC $B1WAIT" 2490 [153]"INSTR'NS. AFTER ALL,MEMORY ONLY GOES" 2500 [153]"TO $FFFF, SO, UNLESS YOU GOOF" 2510 [153]"($B1)<=FF WILL ALWAYS BE TRUE!":[141]63000 2520 [153]"LOADNOTE THAT INCREMENTING THE ADDRESS" 2530 [153]"IN $B0/$B1 BY $0100 ONLY REQUIRES" 2540 [153]"INC $B1WAIT. IF YOU WANT TO INCREMENT" 2550 [153]"BY $0001 YOU CAN DO IT THIS WAY:" 2560 [153]" ------- " 2570 [153]" INC $B0 ":[153]" BNE NEXT":[153]" INC $B1 " 2580 [153]"NEXT ------- " 2590 [153]"THIS ADDS '1' TO ($B0).IF IT DOESN'T" 2600 [153]"OVERFLOWWAIT FROM FF TO 00 WE CONTINUE" 2610 [153]"WITH THE 'NEXT' INTRUCTION." 2620 [153]"IF IT DOES OVERFLOW TO 00WAIT" 2630 [153]"THE BNE NEXTWAIT WILL NOT TAKE US TO" 2640 [153]"'NEXT', AND WE ADD '1' TO THE HI-BYTE" 2650 [153]"WITH INC $B1WAIT.":[141]63000 2660 [153]"LOADIF YOU WANT TO INCREMENT BY OTHER THAN" 2670 [153]"$0001 OR $0100 (INC $B0WAIT OR INC $B1WAIT)" 2680 [153]"THEN YOU NEED TO ADDWAIT THE INCREMENT." 2685 [153]"SUPPOSE WE WANT TO ADD $1F:" 2690 [153]"LDA $B0 WAIT_GET LO-BYTE" 2700 [153]"ADC #$1FWAIT_ADD #$1F TO LO-BYTE" 2710 [153]"STA $B0 WAIT_PUT IT BACK" 2720 [153]"LDA $B1 WAIT_GET HI-BYTE" 2730 [153]"ADC #$00WAIT_ADD ZERO(?!)":[153]"STA $B1 WAIT_PUT IT BACK" 2740 [153]"YOU SEE..ADDING #$1F MIGHT JUST CAUSE" 2750 [153]"THE CONTENTS OF $B0 TO OVERFLOWWAIT WHICH" 2760 [153]"CAUSES CARRYWAIT=1. SO WE ADD THE CARRY" 2770 [153]"TO ($B1) WITH LDA $B1WAIT & ADC #$00" 2780 [153]"NOTECMDCMDCMDCMDFREFREFREFREON:ADCWAIT MEANS ADWAITD WITH CWAITARRY.":[141]63000 2790 [153]"":[129]I[178]1[164]8:[153]CL$:[130]:[153]"" 2800 [153]"OF COURSE THE CARRYWAIT MAY BE 1WAIT WHEN" 2810 [153]"THE ABOVE PIECE OF CODE STARTS, SO" 2820 [153]"WE MUST ALWAYSCMDCMDCMDCMDCMDCMDFREFREFREFREFREFREON CLCWAIT BEFORE AN ADCWAIT!":[141]63010 2830 [153]"CLC ":[141]63000 2840 [153]"LOADIF YOU WANT TO SUBTRACTWAIT #$1FWAIT YOU:" 2850 [153]"LDA $B0 ":[153]"SBC #$1FWAIT_SUBTRACT $1F":[153]"STA $B0 " 2860 [153]"LDA $B1 ":[153]"SBC #$00WAIT_SUBTRACT $00!!":[153]"STA $B1 " 2870 [153]"NOTECMDCMDCMDCMDFREFREFREFREON:SBCWAIT MEANS SWAITUBWAITTRACT WITH CWAITARRY." 2880 [153]"HOWEVER, WITH SBCWAIT YOU MUST HAVE" 2890 [153]"CARRY=1 TO START WITH!!":MS$[178]"*?UGH!*?!!":[141]63000:[141]63100 2900 [141]63010:[153]"SEC ":[141]63000 3000 [153]"LOAD":MS$[178]"AU REVOIR!WAIT":[141]63100:[153]"":[128] 9999 [137]9999 40098 [151]A(0),32:[129]TT[178]1[164]PP:[130]:[129]I[178]0[164]6:[151]A(I[170]1),32 40099 [151]A(I),[197]([202](N$,I[170]1,1))[170]48:[129]TT[178]1[164]PP:[130]:[130]:[151]A(7),48:[142] 40110 [129]I[178]0[164]7:[151]A(I),160:[129]TT[178]1[164]PP:[130] 40111 [151]A(I),[197]([202](N$,I[170]1,1))[170]48:[130]:[142] 40120 [129]I[178]0[164]7:[151]P(I),160:[129]TT[178]1[164]PP:[130] 40121 [151]P(I),[197]([202](N$,I[170]1,1))[170]48:[130]:[142] 40130 [129]I[178]0[164]7:[151]X(I),160:[129]TT[178]1[164]PP:[130] 40131 [151]X(I),[197]([202](N$,I[170]1,1))[170]48:[130]:[142] 40140 [129]I[178]0[164]7:[151]Y(I),160:[129]TT[178]1[164]PP:[130] 40141 [151]Y(I),[197]([202](N$,I[170]1,1))[170]48:[130]:[142] 40160 [129]I[178]0[164]7:[151]M(I),160:[129]TT[178]1[164]PP:[130] 40161 [151]M(I),[197]([202](N$,I[170]1,1))[170]48:[130]:[142] 41120 [129]I[178]0[164]7:[151]P(I),160:[129]TT[178]1[164]PP:[130] 41121 [151]P(I),[194](A(I)):[130]:[142] 41130 [129]I[178]0[164]7:[151]X(I),160:[129]TT[178]1[164]PP:[130] 41131 [151]X(I),[194](A(I)):[130]:[142] 41140 [129]I[178]0[164]7:[151]Y(I),160:[129]TT[178]1[164]PP:[130] 41141 [151]Y(I),[194](A(I)):[130]:[142] 41160 [129]I[178]0[164]7:[151]M(I),160:[129]TT[178]1[164]PP:[130] 41161 [151]M(I),[194](A(I)):[130]:[142] 41340 [129]I[178]0[164]7:[151]A(I),160:[129]TT[178]1[164]PP:[130] 41341 [151]A(I),[194](X(I)):[130]:[142] 41360 [129]I[178]0[164]7:[151]M(I),160:[129]TT[178]1[164]PP:[130] 41361 [151]M(I),[194](X(I)):[130]:[142] 41410 [129]I[178]0[164]7:[151]A(I),160:[129]TT[178]1[164]PP:[130] 41411 [151]A(I),[194](Y(I)):[130]:[142] 41460 [129]I[178]0[164]7:[151]M(I),160:[129]TT[178]1[164]PP:[130] 41461 [151]M(I),[194](Y(I)):[130]:[142] 60000 R$[178]"ORTAN=TAN=TAN=TAN=TAN=TAN=TAN=TAN^CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD(null)CLOSE(null)CLOSE(null)CLOSE(null)CLOSE(null)CLOSE(null)CLOSE(null)CLOSE(null)CLOSE(null)" 60001 R$[178]R$[170]"CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD/TAN>TAN>TAN>TAN>TAN>TAN>TAN>TANEXP" 60002 A$[178]" AWAITON"[170]R$:P$[178]"PWAITON"[170]R$ 60003 X$[178]" XWAITON"[170]R$:Y$[178]"YWAITON"[170]R$ 60004 M$[178]"MWAITON"[170]R$ 60005 CR$[178]"ORTAN^CMDCMDCMD(null)(null)CMDCMDCMD/TANEXP" 60006 CC$[178]" AWAIT(null)CMDCMDCMD CMD CMD CMD CMD CMDCMDCMD CMDCMDCMD ON " 60007 WD[178]40:CRT[178]1024:[153][199](142) 60008 [129]I[178]0[164]7:A(I)[178]CRT[170]WD[170]3[170]2[172]I:P(I)[178]A(I)[170]20:X(I)[178]A(I)[170]3[172]WD:Y(I)[178]X(I)[170]20 60009 M(I)[178]Y(I)[170]3[172]WD:[130]:C[178]CRT[170]7[172]WD[170]1 60010 SD$[178]"":CL$[178]"":[129]I[178]1[164]WD[171]2:CL$[178]CL$[170]" ":[130] 60011 BT$[178]"":[129]I[178]1[164]24:BT$[178]BT$[170]"":[130] 60012 C$[178]CR$[170]"ORTAN<CMDCMDCMD(null)CMD(null)CMD(null)CMD(null)CMD-_CARRY BIT" 60019 ML$[178]"" 60020 PP[178]20 60051 BT$[178]"":[129]I[178]1[164]24:BT$[178]BT$[170]"":[130] 60052 PT$[178]"ORTANTANTANTANTANTANTANTANTANTAN^CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD(null)(null)CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD/=TANTANTANTANTANTANTANTAN=EXP" 60053 PT$[178]PT$[170]"CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD(null)TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB((null)CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDFN============THEN" 60054 PT$[178]PT$[170]"CMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD(null)(null)TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB(TAB((null)(null)ONONONONCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMDCMD" 60055 PT$[178]BT$[170]"ONONONONONON"[170]PT$[170]"STOP" 60056 ML$[178]"" 60057 WD[178]40:CRT[178]1024:[153][199](142) 60058 W2[178]WD[173]2:W3[178]WD[171]1:W1$[178][202]([196](WD),2): 60059 W2$[178][202]([196](W2),2):W3$[178][202]([196](W3),2) 60100 [142] 63000 [153]BT$CL$; 63001 [153]BT$"RETURNWAIT TO CONTINUE"; 63002 [161]Z$:[139]Z$[179][177]""[167]63002 63003 [161]Z$:[139]Z$[178]""[167]63003 63004 [142] 63010 [153]BT$CL$; 63011 [153]BT$"SPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC(RETURN TO SEE IT HAPPENWAITSPC(SPC(SPC(SPC(SPC(SPC(SPC(SPC("; 63012 [161]Z$:[139]Z$[179][177]""[167]63012 63013 [161]Z$:[139]Z$[178]""[167]63013 63014 [142] 63100 [129]T[178]1[164]5:[153]PT$MS$; 63101 [153]PT$" "; 63102 [153]PT$MS$;:[130] 63103 [142] 63200 [141]63000 63201 [153]SD$;:[129]T[178]1[164]10:[153]CL$:[130]:[153]SD$;:[142] 63300 [141]63100:[141]63010:[142] 63999 [141]60000:[153]"LOAD":[137]1630